﻿package
{
	import org.flixel.FlxSprite;
	import org.flixel.FlxG;
	import caurina.transitions.Tweener;
	
	/**
	 * ...
	 * @author Fortyseven
	 */
	public class ASUFOShot extends FlxSprite
	{
		[Embed(source = 'data/ufo_shot.png')] private var imgUFOBlast:Class;
		
		private var _trans:Array = ["linear", "easeInCubic", "easeInQuad"]; // I probably shouldn't be doing this...but it's too tempting not to do. :)
		
		public function ASUFOShot()
		{
			super();
			width = 8;
			height = 8;
			loadGraphic(imgUFOBlast, false, false, width, height);
			visible = false;
			exists = false;
			dead = true;
		}
		
		public function spawn(X:uint, Y:uint, X2:uint, Y2:uint):void
		{
			this.x = X;
			this.y = Y;
			visible = true;
			exists = true;
			dead = false;
			Tweener.addTween(this, { x:X2, y:Y2, time:ASF.UFO_SHOT_SPEED, onComplete:killme, transition: FlxG.getRandom(_trans) } );
		}
		
		override public function hurt(Damage:Number):void
		{
			super.hurt(Damage);
			visible = false;
			exists = false;
			dead = true;
		}
		
		public function killme():void
		{
			hurt(0);
		}
		
		override public function update():void
		{
			super.update();
		}
		
	}

}